package main

import "fmt"

type Person struct {
	name string
	age  int
	sex  string
}

type Student struct {
	Person //匿名字段
	id    int
	name  string //同名字段
	score int
}

func main() {

	var s1 Student

	s1.id = 1
	s1.name = "zs" //采用就近原则,使用子类
	s1.Person.name = "ls"
	s1.age = 18
	s1.sex = "男"
	s1.score = 99

	fmt.Println(s1)

	s2 := Student{Person{"zs", 18, "男"}, 1, "ls", 22}
	fmt.Println(s2)
}
